﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 字符串
{
    class Program
    {
        static void Main(string[] args)
        {
            //string str = "";

            //if (str == null || str == "")
            //{
            //    Console.WriteLine("空");
            //}
            //if (string.IsNullOrEmpty(str)) //等价与str == null || str == ""
            //{
            //    Console.WriteLine("空");
            //}

            string str = "sdadsafgg";
            Console.WriteLine(str);

            char t = str[3];              //读取str第4个元素的值
            Console.WriteLine(t);
            //str[3] = 'a';    //报错，string 类型只能读不能改

            char[] chars = str.ToCharArray();
            chars[3] = 'a';
            str = new string(chars);
            Console.WriteLine(str);

            Console.ReadKey();
        }
    }
}
